
<template>

  <el-container class="home-container">
    <!-- 头部区域 -->
    <el-header>
      <div>
        <img src="../assets/img/logo.png" alt="">
        <span> 车辆租赁系统 </span>
      </div>
      <el-button type="success" plain @click="logout()">退出</el-button>
    </el-header>


    <!-- 页面主体区域 -->
    <el-container >
      <!-- 侧边栏 -->
      <el-aside width="200px">
        <el-menu
          background-color="#333744"
          text-color="#fff"
          active-text-color=""
          router
          default-active="/homepage/vehicle"
          :default-openeds="['1']" >
          <!-- 一级菜单 -->
          <el-submenu index="1">
            <!-- 图标 -->
            <template slot="title"><i class="el-icon-menu"></i>列表</template>
            <el-menu-item-group >
              <el-menu-item index="/homepage/vehicle">
                <i class="el-icon-s-order"></i>车辆管理</el-menu-item>
              <el-menu-item index="/homepage/customer">
                <i class="el-icon-s-order"></i>客户管理</el-menu-item>
              <el-menu-item index="/homepage/driver">
                <i class="el-icon-s-order"></i>司机管理</el-menu-item>
              <el-menu-item index="/homepage/business">
                <i class="el-icon-s-order"></i>业务管理</el-menu-item>
              <el-menu-item index="/homepage/userinfo">
                <i class="el-icon-s-custom"></i>用户管理</el-menu-item>
            </el-menu-item-group>

          </el-submenu>
        </el-menu>
      </el-aside>
      <!-- 右侧内容主体 -->
      <router-view></router-view>
    </el-container>



  </el-container>

</template>

<script>
export default {
  name: 'homepage',
  data() {
    return {
    }
  },


  methods :{
    logout: function(){//退出的具体实现
      sessionStorage.clear();//清空所有缓存方法
      this.$router.push('/login');//退出就是回到了登录页面
      this.$message.success('您已退出');//提示已退出
    }
  }
}

</script>
<style lang="less" >

.home-container{
  height: 100%;
}
.el-header {
  background-color: rgb(175, 180, 219);
  color: #333;
  line-height: 60px;
  display: flex;
  justify-content: space-between;  //组件隔离
  align-items: center;  //组件位置
  font-size: 20px;
  > div{
    display:flex;
    align-items: center;  //div组件位置
    span {
      margin-left: 15px;  //图标和字间距
    }
  }
}

.el-aside {
  background-color: #333744;
  color: #333;
  height: 600px;
  .el-menu{
    border-right: none;
  }
  .el-submenu{
    text-align: left;
    .el-submenu__title {
      padding: 20px;
    }
  }
  .el-menu-item{//左边目录的样式
    text-align: left;
  }


}

</style>
